import Banner from "./Banner";
import HealthAdvicePanel from "./HealthAdvicePanel";



const { ccclass, property } = cc._decorator;

@ccclass
export default class MainPanel extends cc.Component {
    @property(cc.Node)
    AgreePolicyPanel: cc.Node = null;

    start() {
        this.AgreePolicyPanel.getChildByName("ScrollView").getChildByName("view").getChildByName("content").getChildByName("PrivacyLabel").
            getComponent(cc.RichText).string = HealthAdvicePanel.PrivateText;
        Banner.Instance.ShowBanner();
    }


    Hide() {
        if (cc.sys.platform == cc.sys.ANDROID) {
            jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "Hide", "()V");
        } else {
            cc.find("Canvas/PrivacyPanel").active = true;
        }
    }
    KeFu() {
        if (cc.sys.platform == cc.sys.ANDROID) {
            jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "KeFu", "()V");
        }
    }
    MoreGame() {
        if (cc.sys.platform == cc.sys.ANDROID) {
            jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "MoreGame", "()V");
        }
    }
    //注销账号
    ZhuXiao() {
        if (cc.sys.platform == cc.sys.ANDROID) {
            jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "ZhuXiao", "()V");
        } else {
            Banner.Instance.Quit();
        }
    }

    //点击开始游戏
    OnStarGameClick() {
        if (!Banner.IsBlackWhite) {//正常包模式
            Banner.Instance.ShowNativeAd();
        } else {//黑白包模式
            if (Banner.cityIswhite) {//黑包

            } else {//白包

            }
        }
        cc.director.loadScene("Game");
    }

    OnExit_StarGameClick() {
        cc.find("Canvas/介绍").active = false;
    }



    Yes() {
        this.AgreePolicyPanel.active = false;
    }

}
